package com.fengxing.ams.web.facade;

import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.fengxing.ams.web.facade.intf.IDayAccountFacade;
import com.fengxing.ams.web.facade.mouble.account.DayAccount;
import com.fengxing.ams.web.facade.mouble.account.IDayAccountDAO;

@Component
public class DayAccountFacade implements IDayAccountFacade {

	@Autowired
	IDayAccountDAO dayAccountDAO;

	@Override
	public List<DayAccount> queryByVipId(String id) {
		return this.dayAccountDAO.findByVipId(id);
	}

	@Override
	public List<DayAccount> queryByPhone(String id) {
		return this.dayAccountDAO.findByPhone(id);
	}

	@Override
	public List<DayAccount> queryByCarNumber(String id) {
		return this.dayAccountDAO.findByCarNumber(id);
	}

	@Override
	public void save(DayAccount account) {
		this.dayAccountDAO.save(account);
	}

	@Override
	public List<DayAccount> queryByTime(Date todayStartTime, Date endTime) {
		return this.dayAccountDAO.queryByTime(todayStartTime, endTime);
	}

	@Override
	public List<DayAccount> queryAll() {
		List<DayAccount> accounts = new ArrayList<DayAccount> ();
		 Iterator<DayAccount> iter = this.dayAccountDAO.findAll().iterator();
		while (iter.hasNext()) {
			accounts.add(iter.next());
		}
		return accounts;
	}

	@Override
	public List<DayAccount> queryTimes(Date todayStartTime, Date endTime) {
		return this.dayAccountDAO.queryTimes(todayStartTime, endTime);
	}
	
}
